package ma.jee.portailReservation.persistence.announce;

import ma.jee.portailReservation.persistence.reservation.Reservation;
import org.hibernate.annotations.Type;
import org.joda.time.DateTime;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

/**
 * Created by IntelliJ IDEA.
 * User: soufiane
 * Date: 22/12/11
 * Time: 00:58
 * To change this template use File | Settings | File Templates.
 */
@SuppressWarnings("serial")
@Entity
@Table
public class Announce {
    @Id
    @GeneratedValue
    private long idAnnounce;
    @Column(name ="titleAnnounce", nullable = false)
    private String titleAnnounce;
    @Column(name = "dateAnnounce")
    @Type(type="org.joda.time.contrib.hibernate.PersistentDateTime")
    private DateTime dateAnnounce;
    @Column(name ="maxClient", nullable = false)
    private int maxClient;
    @Column(name ="priceAnnounce", nullable = false)
    private float priceAnnounce;
    @Column(name ="descriptionAnnounce", nullable = false)
    private String descriptionAnnounce;
    @OneToMany(mappedBy = "announceReservation", fetch = FetchType.LAZY, cascade =  CascadeType.ALL)
    private Set<Reservation> reservations = new HashSet<Reservation>();

    @ManyToMany(mappedBy="announces", fetch = FetchType.LAZY,  cascade=CascadeType.ALL)
    private Set<Hotel> hotels = new HashSet<Hotel>();

    @OneToMany(mappedBy = "announceTravel", fetch = FetchType.LAZY, cascade =  CascadeType.ALL)
    private Set<Travel> travels = new HashSet<Travel>();

    public long getIdAnnounce() {
        return idAnnounce;
    }

    public void setIdAnnounce(long id) {
        this.idAnnounce = id;
    }

    public String getTitleAnnounce() {
        return titleAnnounce;
    }

    public void setTitleAnnounce(String titleAnnounce) {
        this.titleAnnounce = titleAnnounce;
    }

    public DateTime getDateAnnounce() {
        return dateAnnounce;
    }

    public void setDateAnnounce(DateTime dateAnnounce) {
        this.dateAnnounce = dateAnnounce;
    }

    public int getMaxClient() {
        return maxClient;
    }

    public void setMaxClient(int maxClient) {
        this.maxClient = maxClient;
    }

    public float getPriceAnnounce() {
        return priceAnnounce;
    }

    public void setPriceAnnounce(float priceAnnounce) {
        this.priceAnnounce = priceAnnounce;
    }

    public String getDescriptionAnnounce() {
        return descriptionAnnounce;
    }

    public void setDescriptionAnnounce(String descriptionAnnounce) {
        this.descriptionAnnounce = descriptionAnnounce;
    }

    public Set<Reservation> getReservations() {
        return reservations;
    }

    public void setReservations(Set<Reservation> reservations) {
        this.reservations = reservations;
    }

    public Set<Hotel> getHotels() {
        return hotels;
    }

    public void setHotels(Set<Hotel> hotels) {
        this.hotels = hotels;
    }

    public Set<Travel> getTravels() {
        return travels;
    }

    public void setTravels(Set<Travel> travels) {
        this.travels = travels;
    }
}
